﻿<?php
/*
项目名称：在线简历填写+公众号简历状态实时推送查询系统
微信消息接口开发：@刘继鹏Beta
程序开发：@刘继鹏Beta
前端设计:@刘继鹏Beta
MYSQL：@刘继鹏Beta
开发日期：2017/02/13
*/
error_reporting(0);
header("Content-Type: text/html; charset=UTF-8");
$con = mysql_connect ('localhost','root','root');
            @mysql_select_db('jianli', $con); 
            mysql_query('SET NAMES UTF8');
$appID="";
$appsecret="";
$json= file_get_contents('appid.json');
$time=json_decode($json)->time;
$opid=$system_POST['opid'];
if( time()-$time> 7200){
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appID&secret=$appsecret";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$jsoninfo = json_decode($output, true);
$access_token = $jsoninfo["access_token"];
$json='{"appid":"'.$access_token.'","time":"'.time().'"}';
file_put_contents('appid.json',$json);
$app=$access_token;
}else{
$app=json_decode($json)->appid;	
}
?>